package com.gss.domain.stock;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.NotBlank;

import com.gss.domain.common.CommonDetailsDTO;


@Entity
@Table(name="STOCK_ITEM_TRANSACTION")
public class ItemTransactionDTO extends CommonDetailsDTO
{
	public enum OperationType{Sale,Purchase,Broken,Lost,Return}
	private long transactionId;
	private ItemDetailsDTO item;
	private OperationType opertionType;
	private int quantity;

	private int price;
	private String itemName;
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="ITEM_TRANSC_ID")
	public long getTransactionId() {
		return transactionId;
	}
	public void setTransactionId(long transactionId) {
		this.transactionId = transactionId;
	}
	@ManyToOne
	@JoinColumn(name="ITEM_ID")
	public ItemDetailsDTO getItem() {
		return item;
	}
	public void setItem(ItemDetailsDTO item) {
		this.item = item;
	}
	@Column(name="TRANSACTION_TYPE",nullable=false)
	@Enumerated(value=EnumType.STRING)
	public OperationType getOpertionType() {
		return opertionType;
	}
	public void setOpertionType(OperationType opertionType) {
		this.opertionType = opertionType;
	}
	@Column(name="ITEM_QUANTITY",nullable=false)
	public int getQuantity() {
		return quantity;
	}
	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}
	@Column(name="ITEM_PRICE",nullable=false)
	public int getPrice() {
		return price;
	}
	public void setPrice(int price) {
		this.price = price;
	}
	@Transient
	public String getItemName() {
		return itemName;
	}
	public void setItemName(String itemName) {
		this.itemName = itemName;
	}
	
}
